<?php
require DIR_WS_MODULES.zen_get_module_directory('new_products_by_category.php');

$color_array = array('#A81C43','#6C5941','#000000','#725990','#CD4629','#75ADA0');
if (!empty($new_products_by_category)){
	$row = 0;
	foreach ($new_products_by_category as $cname=>$result_products){
		$color = $color_array[$row%6];
		if (!$result_products->EOF){
			echo '<div style="border:1px solid '.$color.';border-top:3px solid '.$color.';margin-top:5px;padding:0;font-size:20px;">';
			echo '<div><div style="width:300px;background:'.$color.';height:35px;line-height:35px;padding-left:10px;color:#fff">'.$cname.'</div></div>';
			while (!$result_products->EOF){
    			$products_price = $currencies->display_price((zen_get_products_actual_price($result_products->fields['products_id'])),0);

    			$sale_discount = zen_get_products_save($result_products->fields['products_id'],1);				
			    if ($sale_discount!=''){
			    	$special_flag = '<span class="index_icon-discount-s">'.$sale_discount.'</span>';
			    }else{
			    	$special_flag = '';
			    }
				echo '<div style="float:left;margin:5px 17px;width:160px;" >';
				echo '<div style="border:1px solid #EAEAEA;position:relative;" class="module_new_products"><a href="'. zen_href_link(zen_get_info_page($result_products->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($result_products->fields['master_categories_id']) . '&products_id=' . $result_products->fields['products_id']) . '">'.$special_flag.'<span class="index_icon-new-s"></span>' . zen_image(DIR_WS_IMAGES . $result_products->fields['products_image'], $result_products->fields['products_name'],'150','150') . '</a></div>';
				echo '<div style="text-align:center;color:red;font-weight:bold;">'.$products_price.'</div>';
				echo '</div>';
				$result_products->MoveNext();
			}
			echo '<div style="clear:both;"></div>';
			echo '</div>';
		}
		$row++;
	}
}